-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #4611 #4723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #4611 #4723
Conversation
An alternative fix which did not introduce this restriction on SAM types was tried in #4621. For now this fixes the compiler crash. In the future, if one wants to try again and lift the restriction, |
Blocked on #4753 |
1aff0f9
to
e0ff85b
Compare
e0ff85b
to
9c34dd1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a testcase where the implicit result type comes from a type parameter e.g.:
trait Foo[T] {
def bla(x: Int): T
}
val a: Foo[implicit Int => Int] = (x: Int) => 1 // error
@@ -3837,7 +3837,7 @@ object Types { | |||
* A type is a SAM type if it is a reference to a class or trait, which | |||
* | |||
* - has a single abstract method with a method type (ExprType | |||
* and PolyType not allowed!) | |||
* and PolyType not allowed!) which result type is not an implicit function type |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
which -> whose
9c34dd1
to
702a995
Compare
class and trait with a single abstract method which result type is an implicit function type are not considered SAM types anymore. The reason is because the abstract member desugar to mutiple ones. E.g. ```scala trait Foo { def foo(): implicit Int => Int } // becomes trait Foo { def foo(): implicit Int => Int def foo$direct(implicit x: Int): Int } ```
702a995
to
0281bc7
Compare
class and trait with a single abstract method which result type is an
implicit function type are not considered SAM types anymore. The reason
is because the abstract member desugar to mutiple ones. E.g.